package org.gd136.ce.actor;

import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.scenes.scene2d.Group;

public abstract class ShaderGroup extends Group {

	ShaderProgram shader;

	public ShaderGroup(ShaderProgram sp) {
		shader = sp;
	}

	public abstract void setUniform(ShaderProgram shader);

	@Override
	public void draw(Batch batch, float parentAlpha) {
		ShaderProgram old = batch.getShader();
		batch.setShader(shader);
		setUniform(shader);
		super.draw(batch, parentAlpha);
		batch.setShader(old);
	}

}
